package fr.univ.lille1.server.manager;

import java.util.List;

import javax.ejb.Remote;

import fr.univ.lille1.server.domain.Message;

/**
 * @author TagThis
 * 
 * manage messages
 *
 */
@Remote
public interface MessageManager {

	/**
	 * add a place's comment in the database  
	 * @param userId the id of the user who is adding the message
	 * @param title the title of the message to add
	 * @param content the message's content
	 * @param gpsLat one of the gps coordinates: latitude by location
	 * @param gpsLong one of the gps coordinates: longitude by location
	 * @return the message created
	 */
	Message addMessage(int userId, String title, String content,
			float gpsLat, float gpsLong);

	/**
	 * update a certain message
	 * @param messageId the id of the message to update
	 * @param content the new content of the message
	 * @return the message updated
	 */
	Message editMessage(int messageId, String content);

	/**
	 * get a message from its id
	 * @param id the id of the message to find
	 * @return the desired message, null if it does not exist
	 */
	Message findMessageById(int id);

	/**
	 * get a list of a place's comments
	 * @param gpsLat the latitude of the place
	 * @param gpsLong the longitude of the place
	 * @param range scale which allows to cover all possible location coordinates
	 * @return the comments list location
	 */
	List<Message> findMessagesByLocation(float gpsLat, float gpsLong,
			float range);

	/**
	 * like a message from its id and the user's id who wants to like it.
	 * @param id the id of the message to like
	 * @param userId the id of the user who likes the message
	 * @return the message that is liked
	 */
	Message likeMessage(int id, int userId);
	
	/**
	 * dislike a message from its id and the user's id who wants to dislike it.
	 * @param id the id of the message to dislike
	 * @param userId the id of the user who dislikes the message
	 * @return the message that is disliked
	 */
	Message dislikeMessage(int id, int userId);
	
	/**
	 * alert a message from its id and the user's id who wants to alert it.
	 * @param id the id of the message to alert
	 * @param userId the id of the user who wants to alert the message
	 * @return the message that is alerted
	 */
	Message alertMessage(int id, int userId);

	/**
	 * get a list of all user's comments
	 * @param userId the id of the user 
	 * @return the comments list user
	 */
	List<Message> findMessagesByUser(int userId);
	
}
